package com.wanwu.channel.common.enums;

/**
 * @author zhy
 * @date 2020-1-4
 * @descrption 支付宝的交易状态枚举类
 */
public enum AlipayAppTradeStatusEnums {

    WAIT_BUYER_PAY("WAIT_BUYER_PAY", "等待买家付款"),
    WAIT_SELLER_SEND_GOODS("WAIT_SELLER_SEND_GOODS", "买家已付款，等待卖家发货"),
    WAIT_BUYER_CONFIRM_GOODS("WAIT_BUYER_CONFIRM_GOODS", "卖家已发货，等待买家确认"),
    TRADE_FINISHED("TRADE_FINISHED", "交易成功结束"),
    TRADE_CLOSED("TRADE_CLOSED", "交易中途关闭（已结束，未成功完成）"),
    WAIT_SYS_CONFIRM_PAY("WAIT_SYS_CONFIRM_PAY", "支付宝确认买家银行汇款中，暂勿发货"),
    WAIT_SYS_PAY_SELLER("WAIT_SYS_PAY_SELLER", "买家确认收货，等待支付宝打款给卖家"),
    TRADE_REFUSE("TRADE_REFUSE", "立即支付交易拒绝"),
    TRADE_REFUSE_DEALING("TRADE_REFUSE_DEALING", "立即支付交易拒绝中"),
    TRADE_CANCEL("TRADE_CANCEL", "立即支付交易取消"),
    TRADE_PENDING("TRADE_PENDING", "等待卖家收款"),
    TRADE_SUCCESS("TRADE_SUCCESS", "支付成功"),
    BUYER_PRE_AUTH("BUYER_PRE_AUTH", "买家已付款（语音支付）"),
    COD_WAIT_SELLER_SEND_GOODS("COD_WAIT_SELLER_SEND_GOODS", "等待卖家发货（货到付款）"),
    COD_WAIT_BUYER_PAY("COD_WAIT_BUYER_PAY", "等待买家签收付款（货到付款）"),
    COD_WAIT_SYS_PAY_SELLER("COD_WAIT_SYS_PAY_SELLER", "签收成功等待系统打款给卖家（货到付款）"),
    ZHIFUBAO_CONFIRM("ZHIFUBAO_CONFIRM", "客服代买家确认收货"),
    ZHIFUBAO_CANCEL_FP("ZHIFUBAO_CANCEL_FP", "客服代付款方取消快速支付"),
    DAEMON_CONFIRM_CANCEL_PRE_AUTH("DAEMON_CONFIRM_CANCEL_PRE_AUTH", "超时程序取消预授权"),
    DAEMON_CONFIRM_CLOSE("DAEMON_CONFIRM_CLOSE", "超时程序因买家不付款关闭交易"),

    ;

    private String code;
    private String desc;

    AlipayAppTradeStatusEnums(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static AlipayAppTradeStatusEnums getTradeStatusEnum(String code) {
        for (AlipayAppTradeStatusEnums v : AlipayAppTradeStatusEnums.values()) {
            if (code.equals(v.getCode())) {
                return v;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
